﻿using HarmonyLib;
using TUNING;
using UnityEngine;

namespace oxygen_mod
{
    public partial class Patches
    {
        #region 砖块 移动速度加快

        [HarmonyPatch(typeof(TileConfig))]
        [HarmonyPatch("ConfigureBuildingTemplate")]
        public class Patch_a
        {
            private static void Prefix(GameObject go)
            {
                SimCellOccupier simCellOccupier = go.AddOrGet<SimCellOccupier>();
                simCellOccupier.strengthMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_4;
                simCellOccupier.movementSpeedMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_2;
            }
        }

        [HarmonyPatch(typeof(GasPermeableMembraneConfig))]
        [HarmonyPatch("ConfigureBuildingTemplate")]
        public class Patch_b
        {
            private static void Prefix(GameObject go)
            {
                SimCellOccupier simCellOccupier = go.AddOrGet<SimCellOccupier>();
                simCellOccupier.strengthMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_4;
                simCellOccupier.movementSpeedMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_2;
            }
        }

        [HarmonyPatch(typeof(MeshTileConfig))]
        [HarmonyPatch("ConfigureBuildingTemplate")]
        public class Patch_c
        {
            private static void Prefix(GameObject go)
            {
                SimCellOccupier simCellOccupier = go.AddOrGet<SimCellOccupier>();
                simCellOccupier.strengthMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_4;
                simCellOccupier.movementSpeedMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_2;
            }
        }

        [HarmonyPatch(typeof(InsulationTileConfig))]
        [HarmonyPatch("ConfigureBuildingTemplate")]
        public class Patch_d
        {
            private static void Prefix(GameObject go)
            {
                SimCellOccupier simCellOccupier = go.AddOrGet<SimCellOccupier>();
                simCellOccupier.strengthMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_4;
                simCellOccupier.movementSpeedMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_2;
            }
        }

        [HarmonyPatch(typeof(PlasticTileConfig))]
        [HarmonyPatch("ConfigureBuildingTemplate")]
        public class Patch_e
        {
            private static void Prefix(GameObject go)
            {
                SimCellOccupier simCellOccupier = go.AddOrGet<SimCellOccupier>();
                simCellOccupier.strengthMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_4;
                simCellOccupier.movementSpeedMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_2;
            }
        }

        [HarmonyPatch(typeof(MetalTileConfig))]
        [HarmonyPatch("ConfigureBuildingTemplate")]
        public class Patch_f
        {
            private static void Prefix(GameObject go)
            {
                SimCellOccupier simCellOccupier = go.AddOrGet<SimCellOccupier>();
                simCellOccupier.strengthMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_4;
                simCellOccupier.movementSpeedMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_2;
            }
        }

        [HarmonyPatch(typeof(GlassTileConfig))]
        [HarmonyPatch("ConfigureBuildingTemplate")]
        public class Patch_g
        {
            private static void Prefix(GameObject go)
            {
                SimCellOccupier simCellOccupier = go.AddOrGet<SimCellOccupier>();
                simCellOccupier.strengthMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_4;
                simCellOccupier.movementSpeedMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_2;
            }
        }

        [HarmonyPatch(typeof(BunkerTileConfig))]
        [HarmonyPatch("ConfigureBuildingTemplate")]
        public class Patch_h
        {
            private static void Prefix(GameObject go)
            {
                SimCellOccupier simCellOccupier = go.AddOrGet<SimCellOccupier>();
                simCellOccupier.strengthMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_4;
                simCellOccupier.movementSpeedMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_2;
            }
        }

        [HarmonyPatch(typeof(CarpetTileConfig))]
        [HarmonyPatch("ConfigureBuildingTemplate")]
        public class Patch_i
        {
            private static void Prefix(GameObject go)
            {
                SimCellOccupier simCellOccupier = go.AddOrGet<SimCellOccupier>();
                simCellOccupier.strengthMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_4;
                simCellOccupier.movementSpeedMultiplier = DUPLICANTSTATS.MOVEMENT.BONUS_2;
            }
        }

        [HarmonyPatch(typeof(Db))]
        [HarmonyPatch("Initialize")]
        public class Patch_Start
        {
            private static void Prefix()
            {
                DUPLICANTSTATS.MOVEMENT.NEUTRAL = 2f;
                DUPLICANTSTATS.MOVEMENT.BONUS_1 = 4f;
                DUPLICANTSTATS.MOVEMENT.BONUS_2 = 6f;
                DUPLICANTSTATS.MOVEMENT.BONUS_3 = 8f;
                DUPLICANTSTATS.MOVEMENT.BONUS_4 = 10f;
            }
        }

        #endregion  砖块 移动速度加快
    }
}
